#ifndef MAP_H
#define MAP_H
#include "value.h"

typedef struct MapNode
{
    TValue key;
    TValue value;
    u_int next;
} MapNode;

typedef struct Map
{
    ObjectHeader;
    MapNode *array;
    u_int length;
    u_int size;

    MapNode *overflow;
    u_int freeNode;
} Map;

u_int Map_GetHashCode(const TValue *value);
u_int Map_GetRealSize(Map *map);

void Map_Init(Map *self, u_int size);
void Map_Put(Map *self, TValue key, TValue value);
TValue Map_Get(Map *self, TValue key);
TValue Map_Get_By_Cstr(Map *self, _byte *key);
TValue Map_Remove(Map *self, TValue key);
void Map_Clear(Map *self);

void Delete_Map(Object *self);

Map *Map_New(Line *line, u_int size);

#endif